package com.fuluwa.domain.bank.service;

import java.math.BigDecimal;
import java.util.List;

import com.fuluwa.domain.bank.model.Account;
import com.fuluwa.domain.bank.model.ServiceCharge;
import com.fuluwa.infra.event.GlobalEvent;
import com.google.common.collect.Lists;

public class ServiceChargeHelper
{
  private static List<ServiceCharge> list = Lists.newArrayList();
  private static ServiceChargeHelper instance = new ServiceChargeHelper();

  private ServiceChargeHelper() {
    list.add(new ServiceCharge(GlobalEvent.EventType.PRODUCT_SOLD, Account.AccountType.GOLD, new BigDecimal(0.01D)));
  }

  public ServiceCharge find(GlobalEvent.EventType eventType, Account.AccountType accountType) {
    for (ServiceCharge def : list) {
      if (def.equals(new ServiceCharge(eventType, accountType)))
        return def;
    }
    return null;
  }

  public static ServiceChargeHelper getInstance() {
    return instance;
  }
}